import request from '@/utils/request'

/**
 * 新增部门
 * @parm{code,introduce,manager,name,pid} data
 * @returns
*/
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data // 请求体body
  })
}
/**
 * 获取所有的部门
 * @parm{code,introduce,manager,name,pid} data
 * @returns
*/
export function getDepartments() {
  return request({
    url: '/company/department',
    method: 'get'

  })
}
/**
 * 修改部门

 * @returns
*/
export function updateDepartments(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data // 请求体body
  })
}
/**
 * 删除部门
 * @returns
*/
export function delDepartments(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'DELETE'
  })
}
/**
 * 查询部门
 * @parm{code,introduce,manager,name,pid} data
 * @returns
*/
export function getDepartmentsDetail(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'get'

  })
}
